package com.yitao.cms.service.cashCoupons;

import com.skipper.base.bean.DataOutput;
import com.skipper.base.bean.PagedOutput;
import com.yitao.client.dto.cashCoupons.CashCouponsInfoDto;
import com.yitao.cms.dto.cashCoupons.CashCouponsAddDto;
import com.yitao.cms.dto.cashCoupons.CashCouponsDetailDto;
import com.yitao.cms.dto.cashCoupons.CashCouponsListDto;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: wwl
 * @Date: 2020/3/10 14:08
 * @Description:
 */

@FeignClient(name = "userLevel-svc", path = "/userLevel-svc/app/cashCoupon")
public interface CashCouponsService {

    @ApiOperation("现金券信息列表")
    @RequestMapping(method = RequestMethod.POST, path = "/findCashCouponsList", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    PagedOutput<CashCouponsListDto> findCashCouponsList(
            @ApiParam(value = "门店Id") @RequestParam(value = "shopId") Long shopId,
            @ApiParam(value = "优惠券名") @RequestParam(value = "couponsName", required = false) String couponsName,
            @ApiParam(value = "分页参数，表示当前页", required = true, defaultValue = "1") @RequestParam(value = "pageNo") Integer pageNo,
            @ApiParam(value = "分页参数，表示每页显示多少条记录", required = true, defaultValue = "10") @RequestParam(value = "pageSize") Integer pageSize);

    @ApiOperation("编辑现金券信息")
    @RequestMapping(path = "/saveCashCouponsInfo", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    DataOutput saveCashCouponsInfo(@RequestBody CashCouponsAddDto cashCouponsAddDto);

    @ApiOperation("现金券信息列表->关闭，发布操作")
    @RequestMapping(method = RequestMethod.POST, path = "/updateCashCouponsStatus", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    DataOutput updateCashCouponsStatus(
            @ApiParam(value = "登录用户ID") @RequestParam(value = "userId") Long userId,
            @ApiParam(value = "门店Id") @RequestParam(value = "shopId") Long shopId,
            @ApiParam(value = "优惠券id") @RequestParam(value = "couponsId") Long couponsId,
            @ApiParam(value = "优惠券状态") @RequestParam(value = "couponsStatus") Integer couponsStatus);

    @ApiOperation("现金券信息列表->复制")
    @RequestMapping(method = RequestMethod.POST, path = "/cashCouponsInfoCopy", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    DataOutput cashCouponsInfoCopy(
            @ApiParam(value = "登录用户ID") @RequestParam(value = "userId") Long userId,
            @ApiParam(value = "门店Id") @RequestParam(value = "shopId") Long shopId,
            @ApiParam(value = "优惠券id") @RequestParam(value = "couponsId") Long couponsId);

    @ApiOperation("现金券信息列表->详情")
    @RequestMapping(method = RequestMethod.POST, path = "/cashCouponsInfoDetail", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    DataOutput<CashCouponsDetailDto> cashCouponsInfoDetail(
            @ApiParam(value = "登录用户ID") @RequestParam(value = "userId") Long userId,
            @ApiParam(value = "门店Id") @RequestParam(value = "shopId") Long shopId,
            @ApiParam(value = "优惠券id") @RequestParam(value = "couponsId") Long couponsId);

    /**
     * 功能描述: 用户领取优惠券
     */
    @RequestMapping(method = RequestMethod.POST, path = "/addUserCashCoupons", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    DataOutput addUserCashCoupons(@ApiParam(value = "店铺id") @RequestParam(value = "shopId") Long shopId,
                                  @ApiParam(value = "优惠券id") @RequestParam(value = "couponsId") Long couponsId,
                                  @ApiParam(value = "用户id") @RequestParam(value = "userId") Long userId,
                                  @ApiParam(value = "用户昵称)") @RequestParam(value = "nickName") String nickName);

    /**
     * 领取优惠券 不加任何判断
     */
    @RequestMapping(method = RequestMethod.POST, path = "/addCashCouponsInfo", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    DataOutput<CashCouponsInfoDto> addCashCouponsInfo(@ApiParam(value = "店铺id") @RequestParam(value = "shopId") Long shopId,
                                                      @ApiParam(value = "优惠券id") @RequestParam(value = "couponsId") Long couponsId,
                                                      @ApiParam(value = "用户id") @RequestParam(value = "userId") Long userId,
                                                      @ApiParam(value = "用户名") @RequestParam(value = "nickName") String nickName);


    @RequestMapping(method = RequestMethod.POST, path = "/getCashCouponsInfoByCode", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    CashCouponsInfoDto getCashCouponsInfoByCode(@ApiParam(value = "优惠券Code") @RequestParam(value = "couponsCode") String couponsCode);

    @RequestMapping(path = "/updateCashCouponsInfoByBean", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    void updateCashCouponsInfoByBean(@RequestBody CashCouponsInfoDto cashCouponsInfoDto);

}